package DTO;

import Myutils.StringUtil;
import lombok.Data;

@Data
public class Address {
    public String countryName;
    public String provinceName;
    public String cityName;

    public Address(String countryName, String provinceName, String cityName) {
        this.countryName = countryName;
        this.provinceName = provinceName;
        this.cityName = cityName;
    }

    protected Address clone() throws CloneNotSupportedException{
        return (Address) super.clone();
    }
    private void showAddress() {
        System.out.println("countryName:" + countryName + " provinceName:" + provinceName + " cityName:" + cityName);
    }
    private boolean checkAddress(int maxNum,int minNum) {
        if (maxNum < minNum) {
            System.out.println("maxNum < minNum");
        }
        int count = 0;
        if(!StringUtil.isEmpty(countryName)) {
            count++;
        }
        if(!StringUtil.isEmpty(provinceName)) {
            count++;
        }
        if(!StringUtil.isEmpty(cityName)) {
            count++;
        }
        if(count <= maxNum && count >= minNum) {
            return true;
        } else {
            return false;
        }
    }

}
